package com.wsd.music.service.imp;

import com.wsd.music.entity.SongList;
import com.wsd.music.mapper.SongListMapper;
import com.wsd.music.service.SongListService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SongListServiceImp implements SongListService {

    @Resource
    private SongListMapper mapper;

    /**
     * 新增歌单
     *
     * @param songList
     * @return
     */
    @Override
    public boolean insert(SongList songList) {
        return mapper.insert(songList) > 0;
    }

    /**
     * 修改歌单信息
     *
     * @param songList
     * @return
     */
    @Override
    public boolean modify(SongList songList) {
        return mapper.modify(songList) > 0;
    }

    /**
     * 通过ID删除歌单
     *
     * @param id
     * @return
     */
    @Override
    public boolean delete(int id) {
        return mapper.delete(id) > 0;
    }

    /**
     * 通过主键ID查询歌单信息
     *
     * @param id
     * @return
     */
    @Override
    public SongList selectById(int id) {
        return mapper.selectById(id);
    }

    /**
     * 查询所有歌单
     *
     * @return
     */
    @Override
    public List<SongList> selectAll() {
        return mapper.selectAll();
    }

    /**
     * 通过歌单标题进行模糊查询
     *
     * @param title
     * @return
     */
    @Override
    public List<SongList> selectSongListByTitle(String title) {
        return mapper.selectSongListByTitle(title);
    }

    /**
     * 根据标题精确查询
     *
     * @param title
     */
    @Override
    public List<SongList> selectSongListAccurateByTitle(String title) {
        return mapper.selectSongListAccurateByTitle(title);
    }

    /**
     * 根据风格模糊查询
     *
     * @param type
     */
    @Override
    public List<SongList> selectSongListByType(String type) {
        return mapper.selectSongListByType(type);
    }
}
